[System.Net.NetworkInformation.NetworkInterface]::GetAllNetworkInterfaces() `
    | where { $_.Supports([System.Net.NetworkInformation.NetworkInterfaceComponent]::IPv4) `
      -and (-not $_.IsReceiveOnly) `
      -and ($_.OperationalStatus -eq "Up") `
    } `
    | foreach { $_.GetIPProperties() } `
    | foreach { $_.DnsAddresses } `
    | where { $_.AddressFamily -eq "InterNetwork" } `
    | foreach { "nameserver $_" }